<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$app->get('/', function () use ($app) {
	abort(403);
    //return $app->version();
});

//test 
$app->get('test/mysql', 'TestController@mysql');
$app->get('test/redis', 'TestController@redis');
$app->get('test/exception', 'TestController@exception');
$app->get('test/log', 'TestController@log');

//站外
//$app->post('accounts/login', ['middleware' => 'auth', 'uses' => 'AccountsController@login']);
$app->post('accounts/login', 'AccountsController@login');
$app->post('accounts/logout', 'AccountsController@logout');
$app->post('accounts/getRegisterCode', 'AccountsController@getRegisterCode');
$app->post('accounts/register', 'AccountsController@register');

$app->post('accounts/getForgetpwdCode', 'AccountsController@getForgetpwdCode');
$app->post('accounts/resetpwd', 'AccountsController@resetpwd');

// 需要登录的接口
$app->group(['middleware' => 'auth'], function () use ($app) {
	$app->post('project/lists', 'ProjectController@lists');
	$app->post('project/create', ["as"=>'create_project', "uses"=>'ProjectController@create']);
	$app->post('project/copy', 'ProjectController@copy');
	$app->post('project/remove', 'ProjectController@remove');
	$app->post('project/count', "ProjectController@count");
	$app->post('project/clear', "ProjectController@clear");

	// 编辑部分
	$app->post('edit/templateinfo', 'EditController@templateinfo');
	$app->post('edit/lotteryinfo', 'EditController@lotteryinfo');
	$app->post('edit/marketinfo', 'EditController@marketinfo');
	$app->post('edit/save', 'EditController@save');

	$app->post('user/info', 'UserController@info');

	$app->post('template/lists', 'TemplateController@lists'); // 模板库
	$app->post('stat/detail', ["as"=>'stat_detail', "uses" => 'EditController@detail']); // 我的数据

	// 背景音乐列表
	$app->post('audio/lists', ["uses" => 'AudioController@lists']);
	$app->post('audio/setbgmusic', ["uses" => 'AudioController@setbgmusic']);

	// 保存图片
	$app->post('image/save/app', ["uses" => 'ImageController@saveToApp']); // 将图片保存到app目录下
	$app->post('image/save/res', ["uses" => 'ImageController@saveToRes']); // 将图片保存到res工程中


	// 获取是否相关功能是否付费了
	$app->post('payment/info', 'PaymentController@info'); // 是否购买了自定义banner 3 , 加载页文字版权去除功能 4
	$app->post('payment/buy', 'PaymentController@buy'); // 购买相关功能

	// 上传兑换码
	$app->post('gamecode/import', 'GameCodeController@import');

});

// 用户案例
$app->post('case/hot_list', 'CaseController@hotList'); // 编辑推荐
$app->post('case/week_list', 'CaseController@weekList'); // 周排行
$app->post('case/month_list', 'CaseController@monthList'); // 月排行

// 行业、节日、场景类别
$app->get('category/case', 'CategoryController@caselist');
$app->get('category/template', 'CategoryController@template');
